Deduplicate UniqueJSONStrings and avoid raw string pointers
Categories
(Core :: Gecko Profiler, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox84 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
UniqueJSONStrings
is needed to write some of the new marker types, so it should be moved to a common location.
This also helps with the Base/Gecko Profilers de-duplication.
While working on it, raw pointer string arguments can be changed to spans, consistent with JSONWriter
changes in bug 1657033.
Assignee | ||
Comment 1•5 years ago
|
||
The two identical copies are UniqueJSONStrings
are combined and moved almost verbatim to BaseProfilerJSONWriter.h.
Assignee | ||
Comment 2•5 years ago
|
||
Document the class and methods.
GetOrAddIndex
is only used internally, so it can be private.
SpliceStringTableElements
can now only work on rvalue UniqueJSONStrings, this emphasizes that it shouldn't be used anymore after this call.
Depends on D95112
Assignee | ||
Comment 3•5 years ago
|
||
For consistency with JSONWriter
(which UniqueJSONStrings' functions use), and for added safety and some efficiency, UniqueJSONStrings now takes Span<const char
> arguments instead of raw pointers to null-terminated strings.
Depends on D95113
Assignee | ||
Comment 4•5 years ago
|
||
The previous patch removed the only two uses of ProfilerStringView::String().
Since it can be potentially expensive (creating a std::string
object, sometimes allocating a buffer, and copying the string contents), it's best to remove it completely.
Comment 6•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/946e8a1c0924
https://hg.mozilla.org/mozilla-central/rev/3489a01f7393
https://hg.mozilla.org/mozilla-central/rev/1d6cd5f0d26e
https://hg.mozilla.org/mozilla-central/rev/8e7a500b4ab9
Description
•